package com.zg.nacos.domain.convert;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zg.nacos.domain.entity.MicroUser;
import com.zg.nacos.domain.vo.MicroUserVo;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/7/9 18:15
 */
@Mapper(componentModel = "spring")
public interface MicroUserConvert {

    MicroUserVo toVo(MicroUser apiService);


    List<MicroUserVo> toVoList(List<MicroUser> users);

    default IPage<MicroUserVo> toVoPage(Page<MicroUser> userPage) {
        // 使用 Page 的 convert 方法

        return userPage.convert(this::toVo);
    }
}
